package com.luocj.brvah_srl.activity;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.luocj.brvah_srl.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/1/20/020.
 */

public class StraggAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    private final ArrayList<Integer> mHeights;

    public StraggAdapter(Context context, @Nullable List<String> data) {
        super(R.layout.item_straggle, data);
        mHeights = new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            mHeights.add((int) (Math.random() * 400 + 300));
        }
    }

    @Override
    protected void convert(BaseViewHolder holder, String item) {
        ViewGroup.LayoutParams lp = holder.getConvertView().getLayoutParams();
        lp.height = mHeights.get(holder.getLayoutPosition() % 5);
        holder.getConvertView().setLayoutParams(lp);
    }
}
